package star.cloud.asme.base.mybatis;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.servlet.http.HttpServletResponse;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import star.cloud.asme.base.dto.Result;
import star.cloud.asme.flowable.form.FormBaseEntity;
import star.cloud.asme.flowable.form.leave.Leave;
import star.cloud.asme.flowable.processInstance.DTO.StartProcessInstanceParams;

import java.util.List;

public interface IBaseService<T extends IBaseEntity<T>> extends IService<T> {

    default Result<T> getOneByCondition(String columnName, Object columnValue) {
        return null;
    }

    default Result<List<T>> getListByCondition(String columnName, Object columnValue) {
        return null;
    }

    default Result<List<T>> getListByConditions(T conditions) {
        return null;
    }

    default Result<IPage<T>> getListByConditionsWithPage(T conditions) {
        return null;
    }

    @Transactional(rollbackFor = Exception.class)
    default Result<T> insertOne(T entity) {
        return null;
    }

    @Transactional(rollbackFor = Exception.class)
    default Result<T> updateOne(T entity) {
        return null;
    }

    default Result<?> physicalDeleteById(Long id) {
        return null;
    }

    default Result<?> logicalDeleteById(Long id) {
        return null;
    }

    default Result<List<T>> getTree() {
        return null;
    }

    default LambdaQueryWrapper<T> createLambdaQueryWrapper(T entity) {
        return null;
    }

    default void setCreatorAndUpdater(T entity) {
    }

    default void setVersion(T entity) {
        entity.setVersion(entity.selectById().getVersion());
    }

    default void exportToExcel(HttpServletResponse response) {
    }

    default void importFromExcel(Long creator, MultipartFile file) {
    }

    void setCreatorAndUpdater(IPage<T> iPage);

    StartProcessInstanceParams generateStartProcessInstanceParams(FormBaseEntity<T> entity);

    void setProcessInstanceInfo(FormBaseEntity<T> entity, ProcessInstance processInstance);

    Result<?> activeById(Long id);


}